package blacknWhite.MarketSalesMonitor;

import android.app.Activity;
import android.media.AudioManager;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.ProgressBar;
import blacknWhite.Libraries.MarketLibrary;
import blacknWhite.Libraries.Utils;

public class CommentsActivity extends Activity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		try {
			super.onCreate(savedInstanceState);
			setContentView(R.layout.activity_comments);
			
			this.setVolumeControlStream(AudioManager.STREAM_MUSIC); 

			ListView list = (ListView) findViewById(R.id.ListViewCommentsItems);
			progressBar = (ProgressBar) findViewById(R.id.title_refresh_comments_progress);

			dataAdapter = new CommentsDataAdapter(this);
			list.setAdapter(dataAdapter);
		} catch (Throwable e) {
			Utils.LogException(e);
		}
	}

	CommentsDataAdapter dataAdapter;
	ProgressBar progressBar;

	public void onHomeClick(View v) {
		this.finish();
	}

	public void onRefreshClick(View v) {
		if (progressBar.getVisibility() == View.VISIBLE)
			return;
		MarketLibrary.refreshComments(progressBar, dataAdapter, this);
	}

}
